package com.kingdee.openimport.patch_service.exception;

import com.kingdee.openimport.patch_service.util.Result;
import com.kingdee.openimport.patch_service.util.ResultUtil;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * 全局的PatchException 处理
 * Created by Niki on 2018/5/9 16:27
 */
@ControllerAdvice
public class GlobalPatchExceptionHandle {
    @ExceptionHandler(PatchException.class)
    @ResponseBody
    public Result<String> handlerPatchException(HttpServletRequest request, PatchException e) {
        return ResultUtil.error(e);
    }
}
